//
//  TKYSafetyConductController.m
//  StationHouseHelper
//
//  Created by apple on 2018/7/9.
//  Copyright © 2018年 铁科院. All rights reserved.
//

#import "TKYSafetyConductController.h"
#import "TKYSafetyCell.h"
@interface TKYSafetyConductController ()<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong)BaseTabelView *tabelV;

@end

@implementation TKYSafetyConductController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"%@", self.str);
    [self setupUI];
    
}

#pragma mark-- 设置界面
- (void)setupUI{
    [self.view addSubview:self.tabelV];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(titleButtonDidRepeatClick) name:@"TKYTitleButtonDidRepeatClickNotification" object:nil];
}
#pragma mark -- UITableViewDataSource, UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 20;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return kHeightScale *110;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    TKYSafetyCell *cell = [tableView dequeueReusableCellWithIdentifier:KSafetyCellID];
    
    return cell;
}

- (BaseTabelView *)tabelV{
    if (_tabelV == nil) {
        _tabelV = [[BaseTabelView alloc]initWithFrame:CGRectMake(0, kHeightScale *35, kScreenWidth,kScreenHeight -MyNavBarHeight -kHeightScale *35 - kHeightScale *200  ) style:UITableViewStylePlain];
        _tabelV.dataSource = self;
        _tabelV.delegate = self;
        [_tabelV registerClass:[TKYSafetyCell class] forCellReuseIdentifier:KSafetyCellID];
        _tabelV.mj_header = [TKYRefreshHeader headerWithRefreshingBlock:^{
            
            
        }];
        
    }
    return _tabelV;
}

- (void)titleButtonDidRepeatClick{
    // 如果当前控制器的view不在window上，就直接返回,否则这个方法调用五次
    if (self.view.window == nil) return;
    
    // 如果当前控制器的view跟window没有重叠，就直接返回
    if (![self.view intersectWithView:self.view.window]) return;
    
    // 进行下拉刷新
    //[self.tableView.mj_header beginRefreshing];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
